package com.atguigu.redis_springboot.base;

import redis.clients.jedis.Jedis;

/**
 * 演示主从复制
 */
public class TestMasterSalve {


    public static void main(String[] args) throws InterruptedException {
        Jedis jedis_M = new Jedis("192.168.200.11", 6379);
        jedis_M.auth("123");
        Jedis jedis_S = new Jedis("192.168.200.11", 6380);
        jedis_S.auth("123");

        jedis_S.slaveof("192.168.200.11", 6379);

        jedis_M.set("k6", "v6");
        Thread.sleep(500);
        System.out.println(jedis_S.get("k6"));
    }

}
